package atom.ui.components 
{
	import atom.ui.ComponentContainer;
	import com.greensock.easing.Strong;
	import com.greensock.TweenLite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author Jorge Braccini
	 */
	public class Block extends ComponentContainer {
		
		public function Block(init:Object=null) {
			super(init);
			
		}
		
		override protected function initialize():void {
			super.initialize();
			
			//content.addEventListener(MouseEvent.ROLL_OVER, handleZoomIn);
			//content.addEventListener(MouseEvent.ROLL_OUT, handleZoomOut);
		}
		
		public function get color():uint { return init.color; }
		
		public function set color(value:uint):void {
			init.color = value;
			invalidate();
		}
		
		override protected function initValues():void {
			super.initValues();
			init.color = 0x005599;
		}
		
		override protected function draw():void {
			//super.draw();
			
			content.graphics.clear();
			//content.graphics.lineStyle(1, 0);
			content.graphics.beginFill(color);
			content.graphics.drawRect(0, 0, width, height);
			content.graphics.endFill();
			
		}
		
		override public function set width(value:Number):void {
			super.width = value;
			dispatchEvent(new Event("atom_invalidate"));
		}
		
		private function handleZoomIn(e:MouseEvent):void {
			TweenLite.to(this, .5, { width: 100, ease: Strong.easeInOut } );
		}
		
		private function handleZoomOut(e:MouseEvent):void {
			TweenLite.to(this, .5, { width: 50, ease: Strong.easeInOut } );
		}
		
	}

}